﻿using System;
using System.Linq;
using System.Windows.Forms;
using NBi.UI.Genbi.Presenter;
using NBi.UI.Genbi.View.TestSuiteGenerator;

namespace NBi.UI.Genbi.Command.TestCases
{
	class OpenTestCasesQueryCommand:  OpenTestCasesCommand
	{
		public OpenTestCasesQueryCommand(TestCasesPresenter presenter)
			:base(presenter)
		{

		}

		/// <summary>
		/// Executes the command logics.
		/// </summary>
		public override void Invoke()
		{
			var openFileDialog = new OpenFileDialog();
			openFileDialog.Filter = "All Files (*.*)|*.*|SQL (Structured Query Language) (*.sql)|*.sql|Multidimensional Expressions (*.mdx)|*.mdx";
			openFileDialog.FilterIndex = 2;
			DialogResult result = openFileDialog.ShowDialog();
			if (result == DialogResult.OK)
				presenter.LoadQuery(openFileDialog.FileName);  
		}
	}
}
